<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <title></title>
   <script type="text/javascript" 
   	src="<%=request.getContextPath() %>/res/js/jquery.js"></script>
  </head>
  <body>
    <form action="#" method="post">
    	<input type="text" id="name" name="name">
    	<br/>
    	<input type="text" id="desc" name="desc">
    	<br/>
    	
    </form>
    <button>保存</button>
   <script type="text/javascript">
   		$(function(){
   			$("button").click(function(){
   				var json = {
   					name:$("#name").val(),
   					desc:$("#desc").val()
   				};
   				//var obj= $("form").serializeArray();
   				//console.log(json);
   				var str= JSON.stringify(json);
   				//console.log(str);
   				var sj= JSON.parse(str);
   				//console.log(sj);
   				$.ajax({
   					type:"POST",
   					url:'r/role/addRole',
   					data:$('form').serialize(),
   					success:function(data){
   						console.log(data);
   					}
   				});
   			});
   		});
   </script>
  </body>
</html>
	